home *** CD-ROM | disk | FTP | other *** search
- Path: ausnews.austin.ibm.com!usenet
- From: mwhitten@vnet.ibm.com (Marc R. Whitten)
- Newsgroups: comp.lang.c++
- Subject: Re: Using ARGV on VAX - How?
- Date: 5 Jan 1996 14:26:06 GMT
- Organization: IBM Dallas Systems Center
- Message-ID: <4cjcdu$93i@ausnews.austin.ibm.com>
- References: <1996Jan5.094956.1@vax.sbu.ac.uk>
- Reply-To: mwhitten@vnet.ibm.com (Marc R. Whitten)
- NNTP-Posting-Host: marc.sl.dfw.ibm.com
- X-Newsreader: IBM NewsReader/2 v1.02
-
- In <1996Jan5.094956.1@vax.sbu.ac.uk>, tonyh@vax.sbu.ac.uk writes:
- >Hi out there everyone,
- >
- >Just a quickie, how do i get VAX to execute the argv
- >command in C.
- >
- >I include stdio.h and stdlib.h, the file is called myfile.c :
- >
- >main (int argc, char *argv[])
- >{
- > if (argv != 2) {
- // ^^^^^^^^^^^^
- // this is your problem...argc contains the count of items passed from the command line...looks
- // like this is just a typo, I'd imagine. try it with
-
- // if (argc < 2) {
- // and everything should be ok.
-
-
-
- > printf("you forgot to enter your name");
- > exit(1);
- > }
- > printf("Hello %s", argv[1]);
- >}
- >
- >when i type exe myfile.c tony it should produce 'Hello Tony'
- >but all i get is :
- >
- > "you forgot to enter your name"
- >
- >can someone email me (if possible) and tell me what I'm doing wrong?
- >
- >
-
- Marc
-
-
- These opinions are mine and do not reflect those of the IBM Corporation.
-